<? 	
$message = ($this->session->flashdata('message')!='')?$this->session->flashdata('message'):'0';
$err 	 = ($this->session->flashdata('err')!='')?$this->session->flashdata('err'):'0';?>
				
<script type="text/javascript">
function delete_gi_confirmation(path){
	var res=confirm("Are you sure you want to delete this image?");
	if(res==true){
		window.location.replace(path);
	}
}
</script>
<section id="content">
	<section class="container_12 clearfix">
		<section id="main" class="grid_9 push_3">
			<article>
				<h1><?=$page_title?></h1>
				<ul class="photos sortable ui-sortable"><?	
					
					if($message!='0'){?>
                         <div id="info_message"><b><?=$message?></b></div><?	
                    }
                    if($err!='0'){?>
                         <div id="info_error"><b><?=$err?></b></div><?	
                   	}
										
					if($hotel_gallery_list==NULL){?>
						<div class="glr_img_not_found_msg"> No Gallery Images Found! </div><?	
					}else{
						foreach($hotel_gallery_list as $hotel_image){
							$image_path		='';
							$thumb_img_path	='';
							$delete_path 		= "/admin/hotel/gallery/".$hotel_image->hotel_id."/4/".$hotel_image->id;
							if($hotel_image->image!=''){
								$image_path  		= "/uploads/hotel/".$hotel_image->hotel_id."/gallery/".$hotel_image->image;
								$thumb_img_path_arr = explode('.',$hotel_image->image);
								$thumb_img 			= $thumb_img_path_arr[0]."_thumb.".$thumb_img_path_arr[1];
								$thumb_img_path 	= "/uploads/hotel/".$hotel_image->hotel_id."/gallery/".$thumb_img;
								
								if(file_exists(substr($image_path,1)) && is_file(substr($image_path,1))){
									$image_path		= $image_path;									
								}else{
									$image_path		='/images/not_found.gif';
									$thumb_img_path ='/images/not_found.gif'; 
								}
								
								if(file_exists(substr($thumb_img_path,1)) && is_file(substr($thumb_img_path,1))){
									$thumb_img_path		= $thumb_img_path;									
								}else{
									$thumb_img_path ='/images/not_found.gif'; 
								}
							}?>
                             
							<li>								
                                <div class="gi_div" style="width:108px; height:108px;">
                                    <img src="<?=$thumb_img_path?>" style="vertical-align:middle;"/>
                                </div>
                                <div class="links">
                                    <a href="/admin/hotel/gallery/<?=$hotel_image->hotel_id?>/3/<?=$hotel_image->id?>">Edit</a>
                                    <a href="<?=$image_path?>" rel="facebox">View</a>
                                    <a class="delete" href="#" onclick="javascript:delete_gi_confirmation('<?=$delete_path?>');">Delete</a>
                                </div>
							</li><?
						}	
					}?>                    
				</ul>
				<?=$hotel_gallery_pagination?>
                <div>
                	<a href="/admin/hotel/gallery/<?=$hotel_id?>/2"><button id="btn_go_back" type="button" class="button">Add New Image</button></a>
                </div>
			</article>			
		</section>
	</section>
</section>